# -*- coding:utf-8 -*-
import logging

# LOG
LOG_SHOW_LEVEL = logging.INFO
LOG_FILE_LEVEL = logging.INFO
LOG_BASE_PATH = "/supeanut_log/"
# --单位（MB)
LOG_FILE_MAXSIZE = 10
LOG_FILE_MAXNUM = 3

# StockTool csv file
INDEX_CODE = ['000001', '000300', '399001', '399005', '399006']

# Local Data
STOCKINFO_CSV_PATH = "/mnt/stock_basic_info"
STOCKINFO_CSV_FILE = "stockinfo.csv"
STOCKINFO_DATAYES_FIELD = ['code','board','short_name','full_name','status','total_shares',\
						   'circulate_shares','intomarket_date','outmarket_date']
STOCKINFO_DATAYES_CODE = 0
STOCKINFO_DATAYES_STATUS = 4
STOCKINFO_DATAYES_INDEX = [0]
CALENDAR_CSV_PATH = "/mnt/stock_basic_info"
CALENDAR_CSV_FILE = "trade_calendar.csv"
CALENDAR_DATAYES_FIELD = ['date','isOpen','prevTradeDate','exchangeCD']
CALENDAR_DATAYES_INDEX = [0]
CALENDAR_DATAYES_DATE_INDEX = 0
CALENDAR_DATAYES_ISOPEN_INDEX = 1
SINA_MINDATA_CSV_PATH = "/mnt/mindata/sina"
# --被引用：DataSupport.SinaDayDataSupoort.verify()以及store()
SINA_MINDATA_FIELD = ['code','open','cur_price','cur_high',\
					  'cur_low','vol_stock','vol_capital','date','time']
SINA_MINDATA_INDEX = [0, 7, 8]
SINA_MINDATA_TIME_INDEX = 8
SINA_DAYDATA_CSV_PATH = '/mnt/daydata/sina'
WS_ORI_DAYDATA_CSV_PATH = '/mnt/ws_ori_data'
WS_DES_DAYDATA_CSV_PATH = '/mnt/daydata/wsdata'
WS_ORI_DAYDATA_CSV_FIELD = ['Date','Open','Low','High','Close','Volume','Amount']


# SINA API
SINA_BASIC_URL = "http://hq.sinajs.cn/list="
SINA_API_TRYMAX = 3
SINA_API_TIMEOUT = 10
SINA_API_ENCODE = "gbk"
SINA_API_LENGTH = 33
SINA_API_BULKNUM = 800

# DATAYES API
DATAYES_DAOQI = "2017-03-20"
DATAYES_API_HOST = 'api.wmcloud.com'
DATAYES_API_TOKEN = "62d0d2f732ce5028ce5ffd6f3d86cc8f27ff4faa1405f7626fafda7b798dd1f8"
DATAYES_API_ENCODE = 'utf-8'
DATAYES_API_HTTPS_PORT = 443
DATAYES_API_BASEPATH = '/data/v1'
DATAYES_API_STOCKINFO = DATAYES_API_BASEPATH + '/api/equity/getEqu.json?field=&ticker=&secID=&equTypeCD=A&listStatusCD='
DATAYES_API_STOCKSUSPEND = DATAYES_API_BASEPATH + '/api/market/getSecTips.json?field=&tipsTypeCD='
DATAYES_API_TRADECALENDAR = DATAYES_API_BASEPATH + '/api/master/getTradeCal.json?field=&exchangeCD=XSHG&beginDate=&endDate='
DATAYES_HTTPS_HEADERS = {"Authorization": "Bearer " + DATAYES_API_TOKEN, "Accept-Encoding": "gzip, deflate"}
DATAYES_HTTPS_METHOD = "GET"
DATAYES_TIMEOUT = 60
DATAYES_TRYMAX = 3

# YAHOO API
#YAHOO_API_CUR = "http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=snd1l1yr"
YAHOO_API_CUR = "http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1d1t1c1ohgv"
YAHOO_API_DAY = "http://table.finance.yahoo.com/table.csv?s=%s"
YAHOO_API_ENCODE = 'UTF-8'
YAHOO_API_CUR_LENGTH = 9
YAHOO_API_DAY_LENGTH = 7

# JUHE API
JUHE_API_CUR = "http://web.juhe.cn:8080/finance/stock/hs?gid=%s&key=a9c55fb7e17f7a130662f688c9aba4a4"
JUHE_API_ENCODE = 'utf-8'

# Url Opener Default Param
URL_OPENER_TIMEOUT = 5
URL_OPENER_USERAGENT = set(['User-agent','Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1'])

# MONGODB
MONGO_CONN_STR = "mongodb://root:mg1qw23er4@127.0.0.1:28019/"
MONGO_DB = "Supeanut"
MONGO_COLL_STOCKINFO = "StockInfo"
MONGO_COLL_TRADE_CALENDAR = "TradeCalendar"
MONGO_COLL_DAYDATA = "DayData"
MONGO_COLL_5MINDATA = "FiveMinData"
MONGO_COLL_EXRIGHTS = "ExRights"

# ExRights Data
EXRIGHTS_DATA_CSV_PATH = "/mnt/exrights"

